<?php
/**
 * Created by PhpStorm.
 * User: sunbo
 * Date: 2019/7/2
 * Time: 1:51 PM
 */
namespace app\index\controller;
use think\Exception;
class Test extends BaseContorller
{
    //http://54.183.116.40:8081  --提币确认
    //admin/111111

    //成列商  13675326342

    //远程测试 手机号  13964212766   announce,advice,asthma,afford,age,approve,aim,artefact,aisle,all,abuse,assume         13964212768
    //用户测试 手机号  13964212788
    //测试key 13964212788

   // 3 检查地址正确接口
    //   H5 兑换成功后 提示是否继续兑换，否    购买记录需要添加更多的信息
    //   web 登录界面去除注册
    //APP_KEY 98c157ec9b8ce4a61531d9d4f9458453  APP_SECRT_CODE gnJg2aJ784Ou/jL6OH+QUQ==
    public function index()
    {
       // session('name', 'thinkphp');
      //  $redd=session('name');  13675326342
        $mobile="+86,17611469686";
       // $this->excel();
        $this->log("我就看看");
        $logn=new CitPayApi();
        //PlusToken4eef588bd3e5cfa2105671fbd4cae2cb     出金订单 PlusTokend9e06ca350c4bb5784760c352a82e7b9   mzBmRgFYuNcJTyHQBzNF2cvj3Qe45gUh1S
          $dddd=  APP_PATH;
            $dwqqqqq=ROOT_PATH;
            $swwwww=THINK_PATH;
          $ssa=RUNTIME_PATH;


        //$logn->Insert_token_bill_mm_report();
       $ssa= $logn->rechargeNotify(0,"mobysr5NZb15iB1EqGcu35BPvtFNimQTo9");
          //$logn->_Send_CustomCoin("e3db4f44-bcce-3a58-1671-41b4406609fa");
         //   $logn-> _app_Registered("1111111","wwwf","1111","","zzzzz","+86");
     //  $logn->Get_Custom_Coin_Address();
          //$logn-> Get_USDT_RechargeNotify();
       // $dwqqqqq[3333];
    //exception("ssssssssBBB");


       //  $logn->_Submit("70a984b3-4b4b-0860-d420-2f31c4ee3233","1","1","4a7d1ed414474e4033ac29ccb8653d9b","222222");
        // $logn->_Cit_Pay_InsertOrder(2,'ea655ae7-30db-decf-cec2-c1c6482b2403');
          //  $logn->withdrawCoin($mobile,10,"mzBmRgFYuNcJTyHQBzNF2cvj3Qe45gUh1S");
           //$dddss= $logn->findOrder("PlusToken4eef588bd3e5cfa2105671fbd4cae2cb");
      //      $logn->withdrawCoin($mobile,10,"mzX1jQAK7SgGHvZyb6kynxZPHvWvEFWMbx");
       //  $dwqqqqq= $logn->accountcheck($mobile);
         // $logn->rechargeNotify(0,"n1HuMPTn7DPSrfwKYY45KqZRU2YJ8pV9Nh");
            // $array=array("update token_user_custom_coin_balance set startdate=now()");
            // $this->db_exec($array);
            //var_dump($response);die;
     //   $data=$logn->_Submit("f4a9efac-9f8d-ecae-6b65-8105385f6c3b",103000000,'2','4a7d1ed414474e4033ac29ccb8653d9b','tkLMhEpHKscfwqUBrD6ZsB4k7WKgkm42F811');



        return $this->json_data($dwqqqqq,"");
    }

    function excel(){
        $filename=APP_PATH."upload/工作簿1.xlsx";
        $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx();
# 可以额外设定只读模式，上面也试用，让工具只读取数据，不处理样式，性能会更好
        $reader->setReadDataOnly(true);
        $spreadsheet = $reader->load($filename);
        $sheet = $spreadsheet->getActiveSheet();
        $rows  = $sheet->getHighestRow();
        for($i = 2; $i <= $rows; $i++) {
            $temp = [];
            $temp['name'] = $sheet->getCell('A' . $i)->getValue();
            $temp['sex'] = $sheet->getCell('B' . $i)->getValue();
            $temp['age'] = $sheet->getCell('C' . $i)->getValue();

            # 防止空行情况
            if (!$temp['name']) {
                continue;
            }

            $users[] = $temp;
        }
    }

    public function send()
    {
        try{
            $chain=new Friend();
            $chain->UpLevel();
          //  $chain->ExecEarning();
           // $array=array("update token_user_custom_coin_balance set startdate=now()");
           // $this->db_exec($array);

        }catch (Exception $e){

        }
        return $this->json_data("升级成功","");
    }

//http://18.162.116.109:8022/public/index.php/callback
//http://3.14.182.61/tp/public/index.php/callback
    public function  callback(){
     try{
         $row=$this->db_select("select value from token_sys_config where guid='1'");
         $date_count=$row[0]["value"];

         $array=array("update token_user_custom_coin_balance set startdate=now(),enddate=DATE_ADD(now(),INTERVAL ".$date_count." DAY) ");

         $array[]="delete from token_bill_earnings WHERE billdate='".date("Y-m-d")."'";
         $this->db_exec($array);
         $chain=new Friend();
         $chain->UpLevel();
         $chain->ExecEarning();

         return $this->json_data("收益成功","");
     }catch (Exception $e){
         return $this->json_data("收益失败",$e->getMessage());
     }

    }






}
